<?php

namespace App\Remote\Tiger\Appraise;

use App\Exceptions\BaseException;
use App\Kuafu\WaiMai\Enum\WaiMaiDBEnum;
use App\Remote\Tiger\Remote;
use GuzzleHttp\Exception\GuzzleException;
use Symfony\Component\HttpFoundation\Request as RequestAlias;

class AppraiseRemote extends Remote
{

    //rms配置对应评价配置
    const SOURCE_TYPE_TIGER_APPRAISE = [
        WaiMaiDBEnum::SOURCE_TYPE_MT_WM  => 10,//外卖-上线外卖
        WaiMaiDBEnum::SOURCE_TYPE_ELM    => 10,//外卖-上线外卖
        WaiMaiDBEnum::SOURCE_TYPE_MT_TG  => 11,//团购-上线团购
        WaiMaiDBEnum::SOURCE_TYPE_DOUYIN => 11,//团购-上线团购
    ];


    /**
     * 日常运营阶段 饿了么外卖上线&美团外卖上线「需推送」 点评团购上线&抖音团购上线「需推送」
     *
     * @param int $shopId
     * @param int $sourceType
     * @param string $thirdShopId
     * @return mixed|void
     * @throws BaseException
     * @throws GuzzleException
     */
    public static function waimaiNotify(int $shopId, int $sourceType, string $thirdShopId)
    {
        return self::customRequest(
            "internal/appraise/eventNotify",
            RequestAlias::METHOD_POST,
            [
                "workOrderNo" => $thirdShopId,
                "shopId"      => $shopId,
                "type"        => self::SOURCE_TYPE_TIGER_APPRAISE[$sourceType] ?? 0
            ]
        );
    }

}
